﻿using System;
using System.Collections.Generic;

namespace My.Blog.Web
{
    public class UserUI
    {
        public static string Delete()
        {
            return @"
                <input type='hidden' name='Id' value='<%=info.Id %>' />
                确定删除？
                <button>确定</button>
                <button class='cancel' onclick='return false;'>取消</button>

        // New
                用户名：<input type='text' name='Name' />
                密码：<input type='text' name='Pasword' />
                <button>确定</button>
                <button class='cancel' onclick='return false;'>取消</button>
        ";
        }

        public static string List()
        {
            return @"
        <% 
            UserHandler h = new UserHandler();
            IList<UserInfo> list = h.Index();

            foreach (UserInfo info in list)
            {
        %>
            <li>
                <input type='checkbox' name='Id' value='<%=info.Id %>' />
                <%= info.Name %>
                <% if( SecurityUI.IsMaintainMode(null) ){ %>
                <a href='Part.aspx?Module=<%=Module %>&Handler=User&Action=Edit&Id=<%=info.Id %>' class='btn-update-article'>编辑</a>
                <a href='Part.aspx?Module=<%=Module %>&Handler=User&Action=Delete&Id=<%=info.Id %>' class='btn-delete-article'>删除</a>
                <%} %>
            </li>
        <% 
            }
        %>
        ";
        }

        public static string Update()
        {
            return @"
        <input type='hidden' name='Id' value='<%=info.Id %>' />
        用户名：<input type='text' name='Name' value='<%=info.Name %>' />
        密码：<input type='text' name='Password' value='<%=info.Password %>'/>
        <button>确定</button>
        <button class='cancel' onclick='return false;'>取消</button>";
        }
    }
}
